/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Start.java
 *
 * Created on 08 Sep 14, 1:44:08
 */
package com.pras.skripsi.view;

import com.pras.skripsi.Identity;
import com.pras.skripsi.sql.DataPasien;
import javax.swing.JOptionPane;

/**
 *
 * @author Pras
 */
public class Start extends javax.swing.JPanel {

    MainFrame frame;

    public Start(MainFrame frame) {
        initComponents();
        this.frame = frame;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txtNama = new javax.swing.JTextField();
        comHari = new javax.swing.JComboBox();
        comBulan = new javax.swing.JComboBox();
        comTahun = new javax.swing.JComboBox();
        radJKPria = new javax.swing.JRadioButton();
        radJKWanita = new javax.swing.JRadioButton();
        radGDA = new javax.swing.JRadioButton();
        radGDB = new javax.swing.JRadioButton();
        radGDAB = new javax.swing.JRadioButton();
        radGDO = new javax.swing.JRadioButton();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAlamat = new javax.swing.JTextArea();

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel1.setText("Nama");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel2.setText("Alamat");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel3.setText("Tanggal Lahir");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel4.setText("Jenis Kelamin");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel5.setText("Gol. Darah");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel6.setText(":");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel7.setText(":");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel8.setText(":");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel9.setText(":");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel10.setText(":");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("DATA PASIEN");

        txtNama.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        comHari.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        comHari.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        comBulan.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        comBulan.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" }));

        comTahun.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        comTahun.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007" }));

        radJKPria.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        radJKPria.setText("Pria");
        radJKPria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radJKPriaActionPerformed(evt);
            }
        });

        radJKWanita.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        radJKWanita.setText("Wanita");
        radJKWanita.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radJKWanitaActionPerformed(evt);
            }
        });

        radGDA.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        radGDA.setText("A");
        radGDA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radGDAActionPerformed(evt);
            }
        });

        radGDB.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        radGDB.setText("B");
        radGDB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radGDBActionPerformed(evt);
            }
        });

        radGDAB.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        radGDAB.setText("AB");
        radGDAB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radGDABActionPerformed(evt);
            }
        });

        radGDO.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        radGDO.setText("O");
        radGDO.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radGDOActionPerformed(evt);
            }
        });

        jButton1.setText("Lanjut");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        txtAlamat.setColumns(20);
        txtAlamat.setRows(5);
        jScrollPane1.setViewportView(txtAlamat);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(23, 23, 23)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(18, 18, 18)
                                .addComponent(txtNama))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addGap(18, 18, 18)
                                .addComponent(jScrollPane1))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel10)
                                        .addGap(18, 18, 18)
                                        .addComponent(radGDA)
                                        .addGap(18, 18, 18)
                                        .addComponent(radGDB)
                                        .addGap(18, 18, 18)
                                        .addComponent(radGDAB)
                                        .addGap(18, 18, 18)
                                        .addComponent(radGDO))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel9)
                                        .addGap(18, 18, 18)
                                        .addComponent(radJKPria)
                                        .addGap(18, 18, 18)
                                        .addComponent(radJKWanita))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel8)
                                        .addGap(18, 18, 18)
                                        .addComponent(comHari, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(comBulan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(comTahun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 0, Short.MAX_VALUE)))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel6)
                    .addComponent(txtNama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jLabel7)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel8)
                    .addComponent(comHari, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comBulan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comTahun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel9)
                    .addComponent(radJKPria)
                    .addComponent(radJKWanita))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel10)
                    .addComponent(radGDA)
                    .addComponent(radGDB)
                    .addComponent(radGDAB)
                    .addComponent(radGDO))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void radJKWanitaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radJKWanitaActionPerformed
        radJKPria.setSelected(false);
    }//GEN-LAST:event_radJKWanitaActionPerformed

    private void radGDABActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radGDABActionPerformed
        radGDA.setSelected(false);
        radGDB.setSelected(false);
        radGDO.setSelected(false);
    }//GEN-LAST:event_radGDABActionPerformed

    private void radJKPriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radJKPriaActionPerformed
        radJKWanita.setSelected(false);
    }//GEN-LAST:event_radJKPriaActionPerformed

    private void radGDAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radGDAActionPerformed
        radGDAB.setSelected(false);
        radGDB.setSelected(false);
        radGDO.setSelected(false);

    }//GEN-LAST:event_radGDAActionPerformed

    private void radGDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radGDBActionPerformed
        radGDA.setSelected(false);
        radGDAB.setSelected(false);
        radGDO.setSelected(false);
    }//GEN-LAST:event_radGDBActionPerformed

    private void radGDOActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radGDOActionPerformed
        radGDA.setSelected(false);
        radGDB.setSelected(false);
        radGDAB.setSelected(false);
    }//GEN-LAST:event_radGDOActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        DataPasien pasien = new DataPasien();

        if (txtNama.getText().trim().equals("")) {
            JOptionPane.showMessageDialog(this, "Nama Belum Diisi !");
        } else if (txtAlamat.getText().trim().equals("")) {
            JOptionPane.showMessageDialog(this, "Alamat Belum Diisi !");
        } else if (!radJKPria.isSelected() && !radJKWanita.isSelected()) {
            JOptionPane.showMessageDialog(this, "Silahkan Pilih Jenis Kelamin");
        } else if (!radGDA.isSelected() && !radGDB.isSelected() && !radGDAB.isSelected() && !radGDO.isSelected()) {
            JOptionPane.showMessageDialog(this, "Silahkan Pilih Golongan Darah");
        } else {
            pasien.setNama(txtNama.getText());
            pasien.setAlamat(txtAlamat.getText());
            pasien.setTanggalLahir(comHari.getSelectedItem() + " " + comBulan.getSelectedItem() + " " + comTahun.getSelectedItem());
            pasien.setJenisKelamin(radJKPria.isSelected() ? "Pria" : "Wanita");
            pasien.setGolonganDarah(radGDA.isSelected() ? "A" : radGDB.isSelected() ? "B"
                    : radGDAB.isSelected() ? "AB" : "O");
            
            Identity.setPasien(pasien);
            
            TestAngka test= new TestAngka(frame);
            frame.getMainScrollPane().setViewportView(test);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox comBulan;
    private javax.swing.JComboBox comHari;
    private javax.swing.JComboBox comTahun;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JRadioButton radGDA;
    private javax.swing.JRadioButton radGDAB;
    private javax.swing.JRadioButton radGDB;
    private javax.swing.JRadioButton radGDO;
    private javax.swing.JRadioButton radJKPria;
    private javax.swing.JRadioButton radJKWanita;
    private javax.swing.JTextArea txtAlamat;
    private javax.swing.JTextField txtNama;
    // End of variables declaration//GEN-END:variables
}
